//package com.thinksns.sociax.t4.android.event;
//
//import android.content.Intent;
//import android.graphics.Bitmap;
//import android.net.Uri;
//import android.os.Bundle;
//import android.os.Environment;
//import android.provider.MediaStore;
//import android.text.InputType;
//import android.text.TextUtils;
//import android.view.Gravity;
//import android.view.KeyEvent;
//import android.view.View;
//import android.view.ViewGroup;
//import android.view.WindowManager;
//import android.widget.AdapterView;
//import android.widget.CheckBox;
//import android.widget.EditText;
//import android.widget.ImageView;
//import android.widget.LinearLayout;
//import android.widget.RelativeLayout;
//import android.widget.TextView;
//import android.widget.Toast;
//
//import com.google.gson.Gson;
//import com.thinksns.sociax.android.R;
//import com.thinksns.sociax.api.Api;
//import com.thinksns.sociax.api.ApiEvent;
//import com.thinksns.sociax.component.CustomTitle;
//import com.thinksns.sociax.component.LeftAndRightTitle;
//import com.thinksns.sociax.component.TimeUtils;
//import com.thinksns.sociax.net.Post;
//import com.thinksns.sociax.t4.android.Thinksns;
//import com.thinksns.sociax.t4.android.ThinksnsAbscractActivity;
//import com.thinksns.sociax.t4.android.data.StaticInApp;
//import com.thinksns.sociax.t4.android.img.Bimp;
//import com.thinksns.sociax.t4.android.popupwindow.EventDateWindow;
//import com.thinksns.sociax.t4.android.popupwindow.EventEditPopupWindow;
//import com.thinksns.sociax.t4.android.popupwindow.EventPickPopupWindow;
//import com.thinksns.sociax.t4.android.popupwindow.EventPickTimePopWindow;
//import com.thinksns.sociax.t4.android.popupwindow.PopupWindowListDialog;
//import com.thinksns.sociax.t4.android.temp.SelectImageListener;
//import com.thinksns.sociax.t4.android.video.ToastUtils;
//import com.thinksns.sociax.t4.component.SmallDialog;
//import com.thinksns.sociax.t4.model.EventCiModel;
//import com.thinksns.sociax.t4.unit.UnitSociax;
//import com.thinksns.sociax.t4.util.LogUtils;
//import com.thinksns.sociax.thinksnsbase.exception.UserDataInvalidException;
//import com.thinksns.sociax.thinksnsbase.network.ApiHttpClient;
//import com.thinksns.sociax.thinksnsbase.utils.FormFile;
//import com.thinksns.sociax.unit.FormPost;
//import com.thinksns.sociax.unit.SociaxUIUtils;
//
//import org.json.JSONException;
//import org.json.JSONObject;
//
//import java.io.File;
//import java.io.IOException;
//import java.util.ArrayList;
//import java.util.Calendar;
//import java.util.Date;
//import java.util.List;
//
//import me.nereo.multi_image_selector.MultiImageSelectorActivity;
//import rx.Observable;
//import rx.Subscriber;
//import rx.android.schedulers.AndroidSchedulers;
//import rx.functions.Func1;
//import rx.schedulers.Schedulers;
//
///**
// * Created by zhiyicx on 2017/5/3.
// */
//
//public class EventCreateActivity extends ThinksnsAbscractActivity implements View.OnClickListener{
//    public static final int LOCATION_RESULT = 1200;
//    public static final int MONEY_REQUEST = 1235;
//    public static final int DETAIL_REQUEST = 1241;
//
//    private EditText event_name_et;
//    private ImageView event_upload_img;
//    private TextView event_stime_tv;
//    private TextView event_etime_tv;
//    private TextView event_location_tv;
//    private TextView event_number_tv;
//    private TextView event_money_tv;
//    private TextView event_category_tv;
//    private TextView event_detail_tv;
//    private RelativeLayout event_detail_rl;
//    private RelativeLayout event_category_rl;
//    private RelativeLayout event_money_rl;
//    private RelativeLayout event_number_rl;
//    private RelativeLayout event_location_rl;
//    private LinearLayout event_etime_ll;
//    private LinearLayout event_stime_ll;
//    private LinearLayout event_create_ll;
//    private CheckBox is_check_cb;
//    private EventPickPopupWindow eventPickPopupWindow;
//    private EventPickTimePopWindow eventPickSTimePopWindow;
//    private EventPickTimePopWindow eventPickETimePopWindow;
//    private EventEditPopupWindow eventEditPopupWindow;
//    private EventEditPopupWindow eventExitPopWindow;
//    private EventDateWindow eventDateWindow;
//    private Calendar calendar;
//    private Date date;
//    private List<String> days;
//    private List<String> hours;
//    private List<String> minutes;
//    private File cameraFile;
//    private ArrayList<EventCiModel> categoryList;
//    private String[] weeeks = {"周日","周一","周二","周三","周四","周五","周六"};
//    private SelectImageListener selectImageListener;
//    private SmallDialog dialog;
//
//    private String tittle;
//    private long sTime = 0l;
//    private long eTime = 0l;
//    private String areaId;
//    private String cityId;
//    private String address;
//    private String place;
//    private String imgId;
//    private String mainNumber;
//    private String price;
//    private String tips;
//    private String cateId;
//    private int audit;
//    private String content;
//    private String longitude;
//    private String latitude;
//    private String mid;
//    private String attach;
//    private String video;
//
//
//    @Override
//    public String getTitleCenter() {
//        return "创建活动";
//    }
//
//    @Override
//    protected CustomTitle setCustomTitle() {
//        LeftAndRightTitle leftAndRightTitle = new LeftAndRightTitle(R.drawable.img_back,"发布", this);
//        return leftAndRightTitle;
//    }
//
//    @Override
//    public View.OnClickListener getLeftListener() {
//        return new View.OnClickListener() {
//            @Override
//            public void onClick(View view) {
//                eventExitPopWindow.showPopAsLocation(event_create_ll,0,-100, Gravity.CENTER);
//            }
//        };
//    }
//
//    @Override
//    protected int getLayoutId() {
//        return R.layout.event_create_activity;
//    }
//
//    @Override
//    protected void onCreate(Bundle savedInstanceState) {
//        super.onCreate(savedInstanceState);
//        getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
//        initView();
//        initData();
//        initListener();
//    }
//
//    private void initData() {
//        dateToWeek();
//        categoryList = (ArrayList<EventCiModel>) getIntent().getSerializableExtra("category");
//        selectImageListener = new SelectImageListener(this,null);
//        eventEditPopupWindow = new EventEditPopupWindow.Builder(this)
//                .setTittle("报名人数")
//                .sethint("填0是默认不限制人数")
//                .setInputType(InputType.TYPE_CLASS_NUMBER)
//                .setOnPopConfirm(new EventEditPopupWindow.OnPopConfirm() {
//                    @Override
//                    public void onConfirm(String et_content) {
//                        event_number_tv.setText(et_content);
//                        mainNumber = et_content;
//                        eventEditPopupWindow.dismiss();
//                    }
//                })
//                .setOnDismissListener(new EventEditPopupWindow.OnDismissListener() {
//                    @Override
//                    public void onDismiss() {
//                        SociaxUIUtils.hideSoftKeyboard(EventCreateActivity.this,event_name_et);
//                    }
//                })
//                .build();
//        eventDateWindow = new EventDateWindow.Builder(this)
//                .setWidth(ViewGroup.LayoutParams.MATCH_PARENT)
//                .build();
//
//        eventExitPopWindow  = new EventEditPopupWindow.Builder(this)
//                .setTittle("提示")
//                .setContent("内容尚未发布，是否返回")
//                .setConfirmText("确定返回")
//                .setCancelText("继续填写")
//                .setIsEdit(false)
//                .setOnPopConfirm(new EventEditPopupWindow.OnPopConfirm() {
//                    @Override
//                    public void onConfirm(String et_content) {
//                        finish();
//                        eventExitPopWindow.dismiss();
//                    }
//                })
//                .setOnPopConfirm(new EventEditPopupWindow.OnPopCancel() {
//                    @Override
//                    public void onCancel() {
//                        eventExitPopWindow.dismiss();
//                    }
//                })
//                .setOnDismissListener(new EventEditPopupWindow.OnDismissListener() {
//                    @Override
//                    public void onDismiss() {
//                        SociaxUIUtils.hideSoftKeyboard(EventCreateActivity.this,event_name_et);
//                    }
//                })
//                .build();
//    }
//
//    private void initView() {
//        event_name_et = (EditText) findViewById(R.id.event_name_tv);
//        event_upload_img = (ImageView) findViewById(R.id.event_upload_img);
//        event_detail_tv = (TextView) findViewById(R.id.event_detail_tv);
//        event_stime_tv = (TextView) findViewById(R.id.event_stime_tv);
//        event_etime_tv = (TextView) findViewById(R.id.event_etime_tv);
//        event_location_tv = (TextView) findViewById(R.id.event_location_tv);
//        event_number_tv = (TextView) findViewById(R.id.event_number_tv);
//        event_money_tv = (TextView) findViewById(R.id.event_money_tv);
//        event_category_tv = (TextView) findViewById(R.id.event_category_tv);
//        event_detail_rl = (RelativeLayout) findViewById(R.id.event_detail_rl);
//        event_category_rl = (RelativeLayout) findViewById(R.id.event_category_rl);
//        event_money_rl = (RelativeLayout) findViewById(R.id.event_money_rl);
//        event_number_rl = (RelativeLayout) findViewById(R.id.event_number_rl);
//        event_location_rl = (RelativeLayout) findViewById(R.id.event_location_rl);
//        is_check_cb = (CheckBox) findViewById(R.id.is_check_cb);
//        event_etime_ll = (LinearLayout) findViewById(R.id.event_etime_ll);
//        event_stime_ll = (LinearLayout) findViewById(R.id.event_stime_ll);
//        event_create_ll = (LinearLayout) findViewById(R.id.event_create_ll);
//    }
//
//    private void initListener(){
//        event_upload_img.setOnClickListener(this);
//        event_stime_ll.setOnClickListener(this);
//        event_etime_ll.setOnClickListener(this);
//        event_location_rl.setOnClickListener(this);
//        event_number_rl.setOnClickListener(this);
//        event_money_rl.setOnClickListener(this);
//        event_category_rl.setOnClickListener(this);
//        event_detail_rl.setOnClickListener(this);
//        is_check_cb.setOnClickListener(this);
//    }
//
//    @Override
//    public void onClick(View view) {
//        switch (view.getId()){
//            case R.id.event_upload_img: // 上传图片
////                selectPicFromCamera();
//                showSelectImagePopUpWindow(event_name_et);
//                break;
//            case R.id.event_stime_ll: //
//                SociaxUIUtils.hideSoftKeyboard(EventCreateActivity.this,event_name_et);
//                eventPickSTimePopWindow.showPopAtDown(event_create_ll);
//                break;
//            case R.id.event_etime_ll:
//                SociaxUIUtils.hideSoftKeyboard(EventCreateActivity.this,event_name_et);
//                eventPickETimePopWindow.showPopAtDown(event_create_ll);
//                break;
//            case R.id.event_location_rl:
//                Intent intent = new Intent(EventCreateActivity.this,EventLocationActivity.class);
//                startActivityForResult(intent,LOCATION_RESULT);
//                break;
//            case R.id.event_number_rl:
////                SociaxUIUtils.hideSoftKeyboard(EventCreateActivity.this,event_name_et);
//                eventEditPopupWindow.showPopAsLocation(event_create_ll,0,-100, Gravity.CENTER);
//                SociaxUIUtils.showSoftKeyborad(EventCreateActivity.this,event_name_et);
//                break;
//            case R.id.event_money_rl: // 活动费用
//                Intent intent1 = new Intent(EventCreateActivity.this,EventCastActivity.class);
//                intent1.putExtra(EventCastActivity.CAST, price);
//                intent1.putExtra(EventCastActivity.CAST_DETAIL, tips);
//                startActivityForResult(intent1,MONEY_REQUEST);
//                break;
//            case R.id.event_category_rl: // 活动类型
//                SociaxUIUtils.hideSoftKeyboard(EventCreateActivity.this,event_name_et);
//                eventPickPopupWindow = new EventPickPopupWindow(this,categoryList,0,
//                        ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT,
//                        event_category_tv.getText().toString());
//                eventPickPopupWindow.setDismissDialogListener(new EventPickPopupWindow.DismissListener() {
//                    @Override
//                    public void onDismiss(String select) {
//                        if(!select.equals("")) {
//                            event_category_tv.setText(select);
//                            for(int i =0 ; i < categoryList.size();i++){
//                                if(select.equals(categoryList.get(i).getName())){
//                                    cateId = categoryList.get(i).getCid()+"";
//                                    return;
//                                }
//                            }
//                        }
//                    }
//                });
//                eventPickPopupWindow.showPopAtDown(event_create_ll);
//                break;
//            case R.id.event_detail_rl: // 活动详情
//                Intent intent2 = new Intent(EventCreateActivity.this,EventDetailCreateActivity.class);
//                intent2.putExtra(EventDetailCreateActivity.DETAIL_BEAN, content);
//                startActivityForResult(intent2,DETAIL_REQUEST);
//                break;
//            case R.id.is_check_cb:
//                break;
//        }
//    }
//
//    @Override
//    public View.OnClickListener getRightListener() {
//        return new View.OnClickListener() {
//            @Override
//            public void onClick(View view) {
//                if(checkData()) {
//                    view.setEnabled(false);
//                    dialog = new SmallDialog(EventCreateActivity.this,"正在发布");
//                    postEvent();
//                }
//            }
//        };
//    }
//
//    private boolean checkData(){
//        audit = is_check_cb.isChecked()? 1:0;
//        tittle = event_name_et.getText().toString();
//        if(TextUtils.isEmpty(tittle)){
//            Toast.makeText(this,"请填写活动标题",Toast.LENGTH_SHORT).show();
//            return false;
//        }
//        if(TextUtils.isEmpty(imgId)){
//            Toast.makeText(this,"请上传活动封面",Toast.LENGTH_SHORT).show();
//            return false;
//        }
//        if(TextUtils.isEmpty(address)){
//            Toast.makeText(this,"请选择活动地址",Toast.LENGTH_SHORT).show();
//            return false;
//        }
//        if(sTime == 0l){
//            Toast.makeText(this,"请选择活动开始时间",Toast.LENGTH_SHORT).show();
//            return false;
//        }
//        if(eTime == 0l){
//            Toast.makeText(this,"请选择活动结束时间",Toast.LENGTH_SHORT).show();
//            return false;
//        }
//        if(TextUtils.isEmpty(mainNumber)){
//            Toast.makeText(this,"请输入活动人数",Toast.LENGTH_SHORT).show();
//            return false;
//        }
//        if(TextUtils.isEmpty(price)){
//            Toast.makeText(this,"请输入活动金额",Toast.LENGTH_SHORT).show();
//            return false;
//        }
//        if(TextUtils.isEmpty(cateId)){
//            Toast.makeText(this,"请选择活动类型",Toast.LENGTH_SHORT).show();
//            return false;
//        }
//        if(TextUtils.isEmpty(content)){
//            Toast.makeText(this,"请输入活动详情",Toast.LENGTH_SHORT).show();
//            return false;
//        }
//
//        return true;
//    }
//
//    private void dateToWeek(){
//        hours = new ArrayList<>();
//        minutes = new ArrayList<>();
//        calendar = Calendar.getInstance();
//        date = new Date();
//        for(int i = 0; i < 60; i++){
//            if(i < 10){
//                hours.add("0" + i);
//                minutes.add("0" + i);
//                LogUtils.logE("0" + i);
//            }else if(i < 24){
//                hours.add("" + i);
//                minutes.add("" + i);
//            }else {
//                minutes.add("" + i);
//            }
//        }
//
//        final long today = date.getTime();
//        Observable.range(1, 2000)
//            .map(new Func1<Integer, String>() {
//                @Override
//                public String call(Integer integer) {
//                    String day;
//                    date.setTime(today + (integer - 1) * 24l * 60l * 60l * 1000l);
//                    calendar.setTime(date);
//                    day = calendar.get(Calendar.YEAR) + "年"
//                            + (calendar.get(Calendar.MONTH) + 1) + "月"
//                            + calendar.get(Calendar.DAY_OF_MONTH) + "日 "
//                            + weeeks[calendar.get(Calendar.DAY_OF_WEEK)-1];
//                    LogUtils.logE(day);
//                    return day;
//                }
//            }).subscribe(new Subscriber<String>() {
//            @Override
//            public void onStart() {
//                days = new ArrayList<>();
//            }
//
//            @Override
//            public void onCompleted() {
//                LogUtils.logE("daysSize" + days.size());
//
//            }
//
//            @Override
//            public void onError(Throwable e) {
//                LogUtils.logE(e.toString());
//            }
//
//            @Override
//            public void onNext(String s) {
//                days.add(s);
//            }
//        });
//
//        eventPickSTimePopWindow = new EventPickTimePopWindow(this,days,hours,minutes,0,
//                ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT);
//        eventPickSTimePopWindow.setDismissDialogListener(new EventPickTimePopWindow.DismissListener() {
//            @Override
//            public void onDismiss(String time) {
//                if(!time.equals("")) {
//                    sTime = TimeUtils.getTime(time,"yyyy-MM-dd HH:mm")/1000l;
//                    LogUtils.logE("time:" + time + sTime);
//                    Date date = new Date();
//                    if(sTime < (date.getTime()/1000l)){
//                        Toast.makeText(EventCreateActivity.this,"开始时间必须大于当前时间",Toast.LENGTH_SHORT).show();
//                        return;
//                    }
//                    if(sTime >= eTime && eTime != 0l){
//                        Toast.makeText(EventCreateActivity.this,"结束时间必须大于开始时间",Toast.LENGTH_SHORT).show();
//                        return;
//                    }
//                    event_stime_tv.setText(time);
//                    LogUtils.logE("sTime" + sTime);
//                }
//            }
//        });
//
//        eventPickETimePopWindow = new EventPickTimePopWindow(this,days,hours,minutes,0,
//                ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT);
//        eventPickETimePopWindow.setDismissDialogListener(new EventPickTimePopWindow.DismissListener() {
//            @Override
//            public void onDismiss(String time) {
//                if(!time.equals("")) {
//                    eTime = TimeUtils.getTime(time,"yyyy-MM-dd HH:mm")/1000l;
//                    LogUtils.logE("time:" + time + eTime);
//                    if(sTime >= eTime){
//                        Toast.makeText(EventCreateActivity.this,"结束时间必须大于开始时间",Toast.LENGTH_SHORT).show();
//                        return;
//                    }
//                    event_etime_tv.setText(time);
//                    LogUtils.logE("eTime" + eTime);
//                }
//            }
//        });
//    }
//
//    /**
//     * 点击更多内的照相图标
//     */
//    private void selectPicFromCamera() {
//        if (!UnitSociax.isExitsSdcard()) {
//            Toast.makeText(this.getApplicationContext(),
//                    "SD卡不存在，不能拍照", Toast.LENGTH_SHORT).show();
//            return;
//        }
//        cameraFile = new File(Environment.getExternalStorageDirectory(),
//                StaticInApp.cache);
//        if (!cameraFile.exists())
//            cameraFile.mkdirs();
//        cameraFile = new File(cameraFile, System.currentTimeMillis() + ".jpg");
//        startActivityForResult(
//                new Intent(MediaStore.ACTION_IMAGE_CAPTURE).putExtra(
//                        MediaStore.EXTRA_OUTPUT, Uri.fromFile(cameraFile)),
//                StaticInApp.REQUEST_CODE_CAMERA);
//    }
//
//    /**
//     * 从本地选择图片
//     */
//    private void selectPicFromLocal() {
//        Intent getImage = new Intent(this, MultiImageSelectorActivity.class);
//        getImage.putExtra(MultiImageSelectorActivity.EXTRA_SHOW_CAMERA, false);
//        getImage.putExtra(MultiImageSelectorActivity.EXTRA_SELECT_MODE, MultiImageSelectorActivity.MODE_SINGLE);
//        getImage.putStringArrayListExtra(MultiImageSelectorActivity.EXTRA_DEFAULT_SELECTED_LIST, new ArrayList<String>());
//        startActivityForResult(getImage, StaticInApp.LOCAL_IMAGE);
//    }
//
//    @Override
//    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
//        super.onActivityResult(requestCode, resultCode, data);
//
//        if (resultCode == RESULT_OK) {
//            Bitmap btp = null;
//            switch (requestCode) {
//                case StaticInApp.LOCAL_IMAGE:
//                    List<String> list = data.getStringArrayListExtra(MultiImageSelectorActivity.EXTRA_RESULT);
//                    if (list != null && list.size() > 0) {
//                        String path = list.get(0);
//                        selectImageListener.setImagePath(path);
//                        setImgFileMessage(path);
//                    }
//                    break;
//                case StaticInApp.REQUEST_CODE_CAMERA:
//                    if (cameraFile != null && cameraFile.exists()) {
//                        String cameraPath = cameraFile.getAbsolutePath();
//                        setImgFileMessage(cameraPath);
//                    }
//                    break;
//                case DETAIL_REQUEST: //活动详情
//                    Bundle bundle = data.getExtras();
//                    EventDetailBean bean = (EventDetailBean) bundle.getSerializable(EventDetailCreateActivity.DETAIL_BEAN);
//                    LogUtils.logE("DETAIL_REQUEST" + bean.toString());
//                    if(bean.getVideo()!="" && !TextUtils.isEmpty(bean.getVideo())){
//                        video = bean.getVideo();
//                    }
//                    if(bean.getAttach()!="" && !TextUtils.isEmpty(bean.getAttach())) {
//                        attach = bean.getAttach();
//                    }
//                    content = bean.getContent();
//                    event_detail_tv.setText(content);
//                    break;
//
//            }
//        }else if(resultCode == EventLocationActivity.LOCATION_RESULT){
//            address = data.getStringExtra("address");
//            areaId = data.getStringExtra("area");
//            cityId =data.getStringExtra("city");
//            place = data.getStringExtra("place");
//            longitude = data.getStringExtra("longtitude");
//            latitude = data.getStringExtra("latitude");
//            event_location_tv.setText(address);
//            LogUtils.logE(address+areaId+cityId+place+longitude+latitude);
//        }else if(resultCode == EventCastActivity.RESULT_CODE){ // 活动费用
//            Bundle bundle = data.getExtras();
//            price = bundle.getString(EventCastActivity.CAST);
//            tips = bundle.getString(EventCastActivity.CAST_DETAIL);
//            event_money_tv.setText(price);
//        }
//    }
//
//    private void showSelectImagePopUpWindow(final View v) {
//        final PopupWindowListDialog.Builder builder = new PopupWindowListDialog.Builder(v.getContext());
//        builder.setOnItemClickListener(new AdapterView.OnItemClickListener() {
//            @Override
//            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
//                if (position == 0) {
//                    selectPicFromLocal();
//                } else if (position == 1) {
//                    selectPicFromCamera();
//                } else {
//                    builder.dimss();
//                }
//            }
//        });
//
//        List<String> datas = new ArrayList<String>();
//        datas.add("本地图片");
//        datas.add("相机拍照");
//        datas.add("取消");
//        builder.create(datas);
//    }
//
//    private void setImgFileMessage(final String img_path) {
//        final SmallDialog dialog = new SmallDialog(this,"正在上传");
//        dialog.show();
//        Observable.just(img_path)
//                .filter(new Func1<String, Boolean>() {
//                    @Override
//                    public Boolean call(String s) {
//                        return (uploadImage(img_path)!=null);
//                    }
//                })
//                .flatMap(new Func1<String, Observable<String>>() {
//                    @Override
//                    public Observable<String> call(String s) {
//                        String json = (String) uploadImage(s);
//                        return Observable.just(json);
//                    }
//                })
//                .subscribeOn(Schedulers.io())
//                .observeOn(AndroidSchedulers.mainThread())
//                .subscribe(new Subscriber<String>() {
//                    @Override
//                    public void onCompleted() {
//                        LogUtils.logE("setImgFileMessage onCompleted");
//                        dialog.dismiss();
//                    }
//
//                    @Override
//                    public void onError(Throwable e) {
//                        dialog.dismiss();
//                        LogUtils.logE("setImgFileMessage" + e.toString());
//                    }
//
//                    @Override
//                    public void onNext(String s) {
//                        dialog.dismiss();
//                        LogUtils.logE("setImgFileMessage" + s);
//                        JSONObject jsonObject = null;
//                        int status = 0;
//                        try {
//                            jsonObject = new JSONObject(s);
//                            status = (int) jsonObject.get("status");
//                            if (!TextUtils.isEmpty(jsonObject.optString("msg"))) {
//                                ToastUtils.showToast(jsonObject.optString("msg"));
//                            }
//                        } catch (JSONException e) {
//                            e.printStackTrace();
//                        }
//                        if(status == 1){
//                            Thinksns application = (Thinksns) EventCreateActivity.this.getApplicationContext();
//                            LogUtils.logE("setImgFileMessage" + img_path);
//                            application.displayImage(img_path, event_upload_img);
//                            Gson gson = new Gson();
//                            EventPhotosBean photosBean = gson.fromJson(s,EventPhotosBean.class);
//                            imgId = photosBean.getData().get(0).getAttach_id()+"";
////                            try {
////                                imgId = jsonObject.getString("attach_id");
////                            } catch (JSONException e) {
////                                e.printStackTrace();
////                            }
//                        }
//                    }
//                });
//    }
//
//    public Object uploadImage(String imageUrl) {
//        Uri.Builder uri = Api.createUrlBuild(ApiEvent.MOD_NAME,
//                ApiEvent.UPLOADIMAGE);
//        Post post = new Post();
//        post.setUri(uri);
//        try {
//            if (imageUrl != null && imageUrl.length() > 0) {
//                File file = new File(imageUrl);
//                FormFile formFile = new FormFile(Bimp.getInputStreamFromLocal(imageUrl, false),
//                        file.getName(), "pic",
//                        "application/octet-stream");
//                String resultTemp = FormPost.post(uri.toString(), null, formFile);
//                return resultTemp;
//            }
//        } catch (IOException e) {
//            e.printStackTrace();
//        }
//        return null;
//    }
//
//    private void postEvent(){
//        try {
//            mid = Thinksns.getUserSql().getLoginedUser().getUid() + "";
//        } catch (UserDataInvalidException e) {
//            e.printStackTrace();
//        }
//        audit = is_check_cb.isChecked()? 1:0;
//        tittle = event_name_et.getText().toString();
//        LogUtils.logE("  tittle " + tittle +
//                "  sTime " + sTime +
//                "  eTime " + eTime +
//                "  areaId " + areaId +
//                "  cityId  " + cityId +
//                "  address " + address +
//                "  place  " + place +
//                "  imgId  " + imgId +
//                "  mainNumber " + mainNumber +
//                "  price " + price +
//                "  tips " + tips +
//                "  cateId " + cateId +
//                "  audit " + audit +
//                "  content " + content +
//                "  longitude " + longitude +
//                "  latitude " + latitude +
//                "  mid " + mid +
//                "  attach " + attach +
//                "  video " + video
//        );
//        Thinksns.getApplication().getApiEvent().create(tittle, sTime + "", eTime + "",
//                areaId, cityId, address, place, imgId, mainNumber, price, tips, cateId,
//                audit, content, longitude, latitude, mid, attach, video, new ApiHttpClient.HttpResponseListener() {
//                    @Override
//                    public void onSuccess(Object result) {
//                        String json = (String) result;
//                        LogUtils.logE("postEvent" + json);
//                        dialog.dismiss();
//                        Toast.makeText(EventCreateActivity.this,"发布成功",Toast.LENGTH_SHORT).show();
//                        finish();
//                    }
//
//                    @Override
//                    public void onError(Object result) {
//                        LogUtils.logE("postEvent" + result);
//                        ToastUtils.showToast("发布失败");
//                        dialog.dismiss();
//                        if (getRightView() != null) {
//                            getRightView().setEnabled(true);
//                        }
//                    }
//                });
//    }
//
//    @Override
//    public boolean dispatchKeyEvent(KeyEvent event) {
//        if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) {//点击的是返回键
//            if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) {//按键的按下事件
//                eventExitPopWindow.showPopAsLocation(event_create_ll,0,-100, Gravity.CENTER);
//            }
//        }
//        return super.dispatchKeyEvent(event);
//    }
//
//}
